import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
import java.util.function.IntFunction;

public class Test07 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "张无忌-15", "赵敏-13", "张强-20", "张三丰-100", "张翠山-40", "j张良-35", "王二麻子-37");
       /* list.stream().forEach(new Consumer<String>(){
            @Override
            public void accept(String s){
                System.out.println(s);
            }
        });*/
        list.stream().forEach(s -> System.out.println(s));
        long count = list.stream().count();
        System.out.println(count);
        Object[] arr1=list.stream().toArray();
        System.out.println(Arrays.toString(arr1));
        /*String[] arr2=list.stream().toArray(new IntFunction<String[]> (){
            @Override
                    public String[] apply(int value){
                return new String[value];
            }
        });*/
        String[] arr2=list.stream().toArray(value->new String[value]);
        System.out.println(Arrays.toString(arr2));

    }
}
